public class TightAgressiveStrategy implements IStrategy{

	private StrategyManager myManager;
	private int timesBetted;
	private int maxRaises;
	private int currentTurn;

	TightAgressiveStrategy(StrategyManager manager) {
		myManager = manager;
		timesBetted = 0;
	}

	public String play() {

		if (myManager.getBiddingNumber() == 1) {
			switch (myManager.getHandType()) {
			case 2:
				if (myManager.getPosition() < 2 || myManager.getHandScore() > 3)
					return "*F";
				// ELSE SNOW
				break;
			case 3:
				if (myManager.getHandScore() > 5 + myManager.getPosition())
					return "*F";
				// ELSE chance to SNOW
				break;
			case 4:
				if (myManager.getHandScore() > 10 + myManager.getPosition())
					return "*F";

				break;
			default:
				return "*F";
			}

			currentTurn = 1;
		}

		if (myManager.isBetterHand())
			return "*F";

		if (currentTurn != myManager.getBiddingNumber()) {
			currentTurn = myManager.getBiddingNumber();
			maxRaises = myManager.random(3) + 1;
			System.out.println("Max betting: "+maxRaises);
			timesBetted = 0;
		}

		if (timesBetted < maxRaises) {
			timesBetted++;
			if (myManager.getBetValue(true) > 0)
				return "*B " + myManager.getBetValue(true);
			else
				return "*F";
		}

		if (myManager.canCheck())
			return "*CH";
		else
			return "*C";
	}

	public String draw() {
			if (myManager.getHandType() == 2)
				return "*CH 2 3";
			if (myManager.getHandType() == 3)
				return "*CH 3";
		return "*CH";
	}

}
